<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
    

    

    



    <meta charset="utf-8">
    
    
    
    <title>控制线程 | 奔跑的蜗牛 | 虚心若愚</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="join,yield">
    <meta name="description" content="join线程Thread提供了让一个线程等待另一个线程完成的方法–join()方法当在某个程序执行流中调用其他线程的join()方法时，调用线程被阻塞，直到被join()方法加入的join线程执行完为止。 public class JoinThread extends Thread &amp;#123;    public JoinThread(String name) &amp;#123;        sup">
<meta name="keywords" content="join,yield">
<meta property="og:type" content="article">
<meta property="og:title" content="控制线程">
<meta property="og:url" content="http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/index.html">
<meta property="og:site_name" content="奔跑的蜗牛">
<meta property="og:description" content="join线程Thread提供了让一个线程等待另一个线程完成的方法–join()方法当在某个程序执行流中调用其他线程的join()方法时，调用线程被阻塞，直到被join()方法加入的join线程执行完为止。 public class JoinThread extends Thread &amp;#123;    public JoinThread(String name) &amp;#123;        sup">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-03-18T04:10:07.587Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="控制线程">
<meta name="twitter:description" content="join线程Thread提供了让一个线程等待另一个线程完成的方法–join()方法当在某个程序执行流中调用其他线程的join()方法时，调用线程被阻塞，直到被join()方法加入的join线程执行完为止。 public class JoinThread extends Thread &amp;#123;    public JoinThread(String name) &amp;#123;        sup">
    
        <link rel="alternative" href="/atom.xml" title="奔跑的蜗牛" type="application/atom+xml">
    
    <link rel="shortcut icon" href="/blog/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@1.5.2/css/style.css">
    <script>window.lazyScripts=[]</script>
</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/blog/img/timg.jpg)">
      <div class="brand">
        <a href="/blog/" class="avatar waves-effect waves-circle waves-light">
          <img src="/blog/img/user2.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">windy</h5>
          <a href="mailto:windynature@163.com" title="windynature@163.com" class="mail">windynature@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/blog/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                归档
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                分类
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/WindyNature" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://git.oschina.net/windynature" target="_blank" >
                <i class="icon icon-lg icon-mayun"></i>
                码云
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">控制线程</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">控制线程</h1>
        <h5 class="subtitle">
            
                <time datetime="2017-04-12T04:44:58.000Z" itemprop="datePublished" class="page-time">
  2017-04-12
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/blog/categories/多线程/">多线程</a></li></ul>

            
        </h5>
    </div>

    

</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#join线程"><span class="post-toc-text">join线程</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#后台线程"><span class="post-toc-text">后台线程</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#线程睡眠-sleep"><span class="post-toc-text">线程睡眠:sleep</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#线程让步：yield"><span class="post-toc-text">线程让步：yield</span></a></li></ol>
        </nav>
    </aside>
    
<article id="post-java/多线程/控制线程"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">控制线程</h1>
        <div class="post-meta">
            <time class="post-time" title="2017年04月12日 12:44" datetime="2017-04-12T04:44:58.000Z"  itemprop="datePublished">2017-04-12</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/blog/categories/多线程/">多线程</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


            

        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="join线程"><a href="#join线程" class="headerlink" title="join线程"></a>join线程</h1><p><strong>Thread提供了让一个线程等待另一个线程完<code>成的方</code>法–join()方法</strong><br>当在某个程序执行流中调用其他线程的join()方法时，调用线程被阻塞，直到被join()方法加入的join线程执行完为止。</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">JoinThread</span> <span class="keyword">extends</span> <span class="title">Thread</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">JoinThread</span><span class="params">(String name)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">super</span>(name);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">run</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">100</span>; i++) &#123;</span><br><span class="line">            System.out.println(getName() + <span class="string">" "</span> + i);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception </span>&#123;</span><br><span class="line">        <span class="comment">//启动子线程</span></span><br><span class="line">        <span class="keyword">new</span> JoinThread(<span class="string">"新线程"</span>).start();</span><br><span class="line"></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">100</span>; i++) &#123;</span><br><span class="line">            <span class="keyword">if</span> (i == <span class="number">20</span>) &#123;</span><br><span class="line">                JoinThread jt = <span class="keyword">new</span> JoinThread(<span class="string">"被Join的线程"</span>);</span><br><span class="line">                jt.start();</span><br><span class="line"></span><br><span class="line">                <span class="comment">//mian线程调用了jt线程的join()方法，main线程</span></span><br><span class="line">                <span class="comment">//必须等jt执行结束后才会向下执行</span></span><br><span class="line">                jt.join();</span><br><span class="line">            &#125;</span><br><span class="line">            System.out.println(Thread.currentThread().getName() + <span class="string">" "</span> + i);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>上面的程序有三个线程：主线程、新线程并发执行，当主线程的循环变量到20的时候，启动了“被Join的线程”，由于是主线程join的，所以主线程将一直处于阻塞状态，直到“被join的线程”执行完成后才执行。</p>
<h1 id="后台线程"><a href="#后台线程" class="headerlink" title="后台线程"></a>后台线程</h1><p>在后台运行，其任务是为其他线程提供服务的线程被称为<code>后台线程（Daemon Thread）</code>，也称为守护线程或精灵线程。JVM的垃圾回收线程就是典型的后台线程。</p>
<p><code>特征：</code>如果所有的前台线程都死亡，后台线程会自动死亡。</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">DaemonThread</span> <span class="keyword">extends</span> <span class="title">Thread</span> </span>&#123;</span><br><span class="line">    <span class="comment">//定义后台线程执行体</span></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">run</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">10000</span>; i++) &#123;</span><br><span class="line">            System.out.println(getName() + <span class="string">" "</span> + i);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        DaemonThread daemonThread = <span class="keyword">new</span> DaemonThread();</span><br><span class="line">        daemonThread.setDaemon(<span class="keyword">true</span>); <span class="comment">//设置为后台线程</span></span><br><span class="line">        daemonThread.start();</span><br><span class="line"></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">10</span>; i++) &#123;</span><br><span class="line">            System.out.println(Thread.currentThread()+ <span class="string">" "</span> + i);</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//=====程序执行到此处，前台线程（main线程）结束</span></span><br><span class="line">        <span class="comment">//后台线程也应该随之结束</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>上面的代码将执行线程设置成后台线程，可以看到当所有的前台线程死亡时，后台线程随之死亡。</p>
<p><strong>注意:</strong></p>
<blockquote>
<p>setDaemon(true)必须在start()方法之前调用，否则会引发IllegalThreadStateException</p>
</blockquote>
<h1 id="线程睡眠-sleep"><a href="#线程睡眠-sleep" class="headerlink" title="线程睡眠:sleep"></a>线程睡眠:sleep</h1><p>如果要让当前正在执行的线程<code>暂停一段时间，并进入阻塞状态</code>，则可以通过调用Thread类的静态<code>sleep()</code>方法来实现。</p>
<h1 id="线程让步：yield"><a href="#线程让步：yield" class="headerlink" title="线程让步：yield"></a>线程让步：yield</h1><p><code>yield()</code>方法可以让当前正在执行的线程暂停，但不会阻塞该线程，只是将该线程转入就绪状态。<br><code>yield()</code>方法只是让当前的线程暂停一下，让系统的线程调度器<code>重新调度一次</code>，完全可能的情况是：当某个线程调用了yield()方法暂停之后，线程调度器<code>又将其调度出来重新执行</code>。</p>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">YieldTest</span> <span class="keyword">extends</span> <span class="title">Thread</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">YieldTest</span><span class="params">(String name)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">super</span>(name);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="meta">@Override</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">run</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">50</span>; i++) &#123;</span><br><span class="line">            System.out.println(getName() + <span class="string">" "</span> + i);</span><br><span class="line">            <span class="comment">//当i等于20的时候，使用yield方法让当前线程让步</span></span><br><span class="line">            <span class="keyword">if</span>(i == <span class="number">20</span>) &#123;</span><br><span class="line">                System.out.println(<span class="string">"--------------"</span>);</span><br><span class="line">                Thread.yield();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        System.out.println(getName()+ <span class="string">" 执行完了======"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        YieldTest yt1 = <span class="keyword">new</span> YieldTest(<span class="string">"高级"</span>);</span><br><span class="line">        yt1.setPriority(Thread.MAX_PRIORITY);</span><br><span class="line">        yt1.start();</span><br><span class="line"></span><br><span class="line">        YieldTest yt2 = <span class="keyword">new</span> YieldTest(<span class="string">"低级"</span>);</span><br><span class="line">        yt2.setPriority(Thread.MIN_PRIORITY);</span><br><span class="line">        yt2.start();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>上面的例子中，优先级高的线程调用yield()方法后<font color="red"><strong>会给与自己优先级相同或优先级更高的线程执行机会</strong></font>。<br><strong>注意：多CPU下效果不明显。</strong></p>
<p><strong>sleep()和yield()方法的区别：</strong></p>
<ul>
<li>sleep()方法暂停当前线程后，会给其他线程执行机会，不会理会其他线程的优先级；但yield()方法<strong>只会给优先级相同，或优先级更高的线程执行机会。</strong></li>
<li>sleep()方法会将线程转入<strong>阻塞状态</strong>，直到经过阻塞时间才会转入就绪状态；而yield()方法不会讲线程转入阻塞状态，它只是<strong>强制将当前线程进入就绪状态。</strong></li>
<li>sleep()方法声明抛出<code>InterruptedException</code>异常，所以调用sleep()方法时要么捕捉该异常，要不显式声明抛出该异常；而yield()方法则没有声明抛出任何异常。</li>
<li>sleep()方法比yield()方法有更好的可移植性，通常不建议使用yield()方法来控制并发线程的执行。</li>
</ul>

        </div>

        <blockquote class="post-copyright">
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-03-18T04:10:07.587Z" itemprop="dateUpdated">2020年3月18日 12:10</time>
</span><br>


        这里写留言或版权声明：<a href="/blog/2017/04/12/java/多线程/控制线程/" target="_blank" rel="external">http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/</a>
    </div>
    <footer>
        <a href="http://windynature.oschina.io">
            <img src="/blog/img/user2.jpg" alt="windy">
            windy
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/join/">join</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/yield/">yield</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/&title=《控制线程》 — 奔跑的蜗牛&pic=http://windynature.oschina.io/img/user2.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/&title=《控制线程》 — 奔跑的蜗牛&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《控制线程》 — 奔跑的蜗牛&url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/&via=http://windynature.oschina.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/blog/2017/04/12/java/多线程/线程同步/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">线程同步</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/blog/2017/04/12/java/多线程/线程的生命周期及优先级/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">线程的生命周期及优先级</h4>
      </a>
    </div>
  
</nav>



    

<div class="comments" id="comments">
    <div class="ds-thread" data-thread-key="java/多线程/控制线程" data-title="控制线程" data-url="http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/"></div>
</div>
<script>
lazyScripts.push('//cdn.bootcss.com/marked/0.3.6/marked.min.js');

var duoshuoQuery = {short_name:'ysblog', theme: 'none'};
lazyScripts.push('//unpkg.com/hexo-theme-material-indigo@1.5.2/js/embed.min.js');


</script>










</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            <span>博客内容遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p>
            <span>Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a></span>
            <span>奔跑的蜗牛 &copy; 2015 - 2020</span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/&title=《控制线程》 — 奔跑的蜗牛&pic=http://windynature.oschina.io/img/user2.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/&title=《控制线程》 — 奔跑的蜗牛&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《控制线程》 — 奔跑的蜗牛&url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/&via=http://windynature.oschina.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://windynature.oschina.io/2017/04/12/java/多线程/控制线程/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/blog/', SHARE: true, REWARD: false };



</script>

<script src="//unpkg.com/hexo-theme-material-indigo@1.5.2/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@1.5.2/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
